﻿function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}

addLoadEvent(function() {
    document.getElementById("dateTime").style.display = "block";
    var tdy = new Date(),
    day = tdy.getDate(),
    month = tdy.getMonth() + 1;

    var date = [(day < 10 ? "0" : "") + day];
    date.push((month < 10 ? "0" : "") + month);
    date.push(tdy.getFullYear());

    document.getElementById("spnDate").innerHTML = date.join("/");
    DisplayTime();
});

function DisplayTime() {
    var tdy = new Date(),
    hours = tdy.getHours(),
    min = tdy.getMinutes(),
    sec = tdy.getSeconds();

    var time = [(hours > 12 ? hours - 12 : (hours == 0) ? 12 : hours)];
    time.push((min < 10 ? ":0" : ":") + min);
    time.push((sec < 10 ? ":0" : ":") + sec);
    time.push(hours >= 12 ? " PM" : " AM");
    document.getElementById("spnTime").innerHTML = time.join("");
    setTimeout("DisplayTime()", 1000);
}

function GetReport(obj) {
    window.open(obj.href, 'reports', 'directories=no,menubar=no,resizable=yes,scrollbars=yes,location=no,toolbar=no,height=600,width=930');
    return false;
}